/**      
 * @file		dynamicArrays.cpp
 * @description		This example demonstrates how to create dynamic
 *			arrays. Up to this point we needed to know how many
 *			elements were in an array or estimate with a large
 *			number of elements, which wasted space.
 *			This example removes that waste.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

/**
 * @return zero if the application executes successfully
 */
int main() {

	int size;
	int *dynamicArray;

	cout << "Tell me how many numbers do you want me to save?\n";
	cin >> size;
	cout << "Now type " << size << " numbers so I can save them.\n";

	// we use the new operator to request memory for the exact amount
	// of memory needed
	dynamicArray = new int[size];
	for(int i = 0; i < size; i++) {
		cout << "saving #" << i+1 << " ";	
		cin >> dynamicArray[i];
	}

	cout << "The numbers you want me to save are:\n";
	for(int i = 0; i < size; i++) {
		cout << "\tdynamicArray[" << i << "] " << dynamicArray[i] << endl;
	}

	// let's clean up our memory
	// for arrays we have to use the brackets to tell the runtime environment
	// that we are deleting an array and not just one integer
	// if we forget the brackets, we will only delete one element
	// and bad things are sure to happen
	delete [] dynamicArray;

	return 0;
}
